<?php
class SeachBusinessController extends AppController {

	var $name = 'SeachBusiness';
	var $uses = array('Invoice','InvoicesDetail');
	function index() {
		
		//pr($_POST);
		$id_user=$this->Session->read("tkid");
		$star=date('Y-m-d', strtotime($_POST['startDate']));
		$end=date('Y-m-d', strtotime($_POST['endDate']));
		$this->InvoicesDetail->recursive = 0;
		$conditions = array('Invoice.created BETWEEN ? and ?' => array($star, $end),'Invoice.id_user'=>$id_user);
		$this->paginate = array('conditions' =>$conditions,'order'=>'Invoice.id DESC','limit' =>20);
        $invoicesDetail = $this->paginate('Invoice');
		$this->set('business',$invoicesDetail);
		$this->set('star',$_POST['startDate']);
		$this->set('end',$_POST['endDate']);			
		

	}
}
?>